<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title> 石头列表 </title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<link rel="stylesheet" href="admin/css/common.css" type="text/css" />
	<link rel="stylesheet" href="admin/css/provider.css" type="text/css" />
	<script type="text/javascript" src="js/jquery-1.7.1.js"></script>
	<script>
	
		function deleteStone(stoneId){
			if(confirm("确定要删除这个石头吗？"))
			{	
				jQuery.post("adminj/deleteStone.action",{stoneId:stoneId},callbackDeleteStone,"json");
			}
		}
		function callbackDeleteStone(value){
			var node = $("#stone_"+value.stoneId);
			node.fadeOut('slow');
		}
		
		function submitStoneDisplay(id, itemId)
		{
			if(document.getElementById(id).checked)
			{
				var params = {displayFlag : "yes", stoneId : itemId};
			}
			else
			{
				var params = {displayFlag : "no", stoneId : itemId};
			}
			jQuery.post("adminj/submitStoneDisplay.action", params, callbackFunc, "json");
		}
		
		function callbackFunc()
		{
			
		}
		
	</script>
  </head>
  
  <body>
  	<div id="provider_zone">
  	<form action="admin/toStoneList.action" method="post">
	  <table width="98%" border="0" align="center"  cellpadding="3" cellspacing="1" class="table_style" style="color: #73938E;	font-size: 9pt;">
	    <thead>
		    <tr>
		    	<td colspan="15" style="background-color: #bbbbbb;">
		    		<input type="text" class="long-input" name="stoneName"  id="stoneName" value="${stoneName }"/>
		    		<input type="submit" value="查询"  onclick="$('#pageno').val('1');" style="line-height: 29px; height: 29px; width:150px; color:#73938E;" />
		    	</td>
		    </tr>
		    <tr>
		    	<td colspan="15" class="left_title_2" style="padding-right: 20px; text-align: left;" align="left">
		    		
		    		<span class="tip">
		    			当前第${page.currentPage}页，总共有${page.totalRows }条记录，总共${page.totalPages } 页。
		    			跳至第<input type="text" name="pageno" id="pageno" value="${pageno }" size="2" maxlength="3" style="text-align: center;"
		    			 onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"
		    			 onblur=" if(this.value > ${page.totalPages }) {this.value = ${page.totalPages };}">页
		    			<input type="submit" value=" GO! " />
		    		</span>
		    		&nbsp;&nbsp;&nbsp;&nbsp;
		    		<c:if test="${page.currentPage != 1}">
		    			<a href="admin/toStoneList.action?pageno=${pageno -1}&hrefFlag=true&stoneName=${stoneName}">上一页</a>
		    		&nbsp;&nbsp;
		    		</c:if>
					<c:if test="${page.currentPage != page.totalPages}">
		    			<a href="admin/toStoneList.action?pageno=${pageno +1}&hrefFlag=true&stoneName=${stoneName}">下一页</a>
		    		</c:if>
				</td>
		    </tr>
	    </thead>
	    <tr class="head">
			<th width="12%">中文名</th>
	     	<th width="12%">英文名</th>
	     	<th width="5%" >产地</th>
	     	<th width="6%" >纹理</th>
	     	<th width="5%" >档次</th>
	     	<th width="5%" >颜色</th>
	     	<th width="5%" >材质</th>
	     	<th width="9%" >更新时间</th>
	     	<th width="6%" >访问量</th>
	     	<th width="6%" >完整度</th>
	     	<th width="34%" >操作</th>
	    </tr>
	    <c:forEach items="${page.list}" var="item" varStatus="loop" > 
		    <tr id="stone_${item.id }">
		    	<td>${item.chineseName }</td>
		    	<td>${item.englishName }</td>
		    	<td align="center">${item.sourceland }</td>
		    	<td align="center">${item.venation }</td>
		    	<td>${item.level }</td>
		    	<td>${item.color }</td>
		    	<td>${item.material }</td>
		    	<td>${item.startTime }</td>
		    	<td><font class="descipt">
		    		${item.visit }
		    		</font></td>
		    	<td>${completeList[loop.count-1] }%</td>
		    	<td> 
		    		<c:if test="${sessionScope.admin.username == 'admin'}">
		    			<a style="cursor:pointer" onclick="deleteStone(${item.id })" >移除 </a>|
		    		</c:if>
		    	  <a href="admin/toEditStone.action?stoneId=${item.id }" style="cursor:pointer" > 编辑</a>
		    	 | <a target="_blank" href="stone/toStoneCompany.action?stoneId=${item.id }" style="cursor:pointer" > 查看</a> 
		    	 | <a href="admin/toModifyDesc.action?stoneId=${item.id }" style="cursor:pointer" > 修改描述</a> 
		    	 | <c:if test="${item.displayFlag == 0}">
		    	 	<input type="checkbox" name="displayFlagCheckBox" value="displayFlagCheckBox" id="displayFlagCheckBox_${item.id }" onclick="submitStoneDisplay('displayFlagCheckBox_${item.id }',${item.id})"/> <span class="display">显示</span>
		    	   </c:if>
		    	   <c:if test="${item.displayFlag != 0}">
		    	    <input type="checkbox" name="displayFlagCheckBox" value="displayFlagCheckBox" id="displayFlagCheckBox_${item.id }" onclick="submitStoneDisplay('displayFlagCheckBox_${item.id }',${item.id})" checked/> <span class="display">显示</span>
		    	   </c:if>
		    	 </td>
		    </tr>
		</c:forEach>
	    <tr>
	    	<td colspan="15" class="left_title_2" style="padding-right: 20px;">
	    		<span class="tip">
	    			当前第${page.currentPage}页，总共有${page.totalRows }条记录，总共${page.totalPages }页
	    		</span>
					&nbsp;&nbsp;&nbsp;&nbsp;
		    		<c:if test="${page.currentPage != 1}">
		    			<a href="admin/toStoneList.action?pageno=${pageno -1}&hrefFlag=true&stoneName=${stoneName}">上一页</a>
		    		&nbsp;&nbsp;
		    		</c:if>
					<c:if test="${page.currentPage != page.totalPages}">
		    			<a href="admin/toStoneList.action?pageno=${pageno +1}&hrefFlag=true&stoneName=${stoneName}">下一页</a>
		    		</c:if>
			</td>
	    </tr>
	  </table>
	  </form>
	</div>
  </body>
</html>
